package com.cblz.bd.common.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 数据回收记录表
 *
 * @TableName ba_security_data_recycle_log
 */
@TableName(value = "ba_security_data_recycle_log")
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class BaSecurityDataRecycleLog implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 操作管理员
     */
    @TableField("admin_id")
    private Integer adminId;
    /**
     * 回收规则ID
     */
    @TableField("recycle_id")
    private Integer recycleId;
    /**
     * 回收的数据
     */
    private String data;
    /**
     * 数据表
     */
    @TableField("data_table")
    private String dataTable;
    /**
     * 数据表主键
     */
    @TableField("primary_key")
    private String primaryKey;
    /**
     * 是否已还原:0=否,1=是
     */
    @TableField("is_restore")
    private Integer isRestore;
    /**
     * 操作者IP
     */
    private String ip;
    /**
     * User Agent
     */
    private String useragent;
    /**
     * 删除时间
     */
    private Long createtime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BaSecurityDataRecycleLog other = (BaSecurityDataRecycleLog) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getAdminId() == null ? other.getAdminId() == null : this.getAdminId().equals(other.getAdminId()))
                && (this.getRecycleId() == null ? other.getRecycleId() == null : this.getRecycleId().equals(other.getRecycleId()))
                && (this.getData() == null ? other.getData() == null : this.getData().equals(other.getData()))
                && (this.getDataTable() == null ? other.getDataTable() == null : this.getDataTable().equals(other.getDataTable()))
                && (this.getPrimaryKey() == null ? other.getPrimaryKey() == null : this.getPrimaryKey().equals(other.getPrimaryKey()))
                && (this.getIsRestore() == null ? other.getIsRestore() == null : this.getIsRestore().equals(other.getIsRestore()))
                && (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp()))
                && (this.getUseragent() == null ? other.getUseragent() == null : this.getUseragent().equals(other.getUseragent()))
                && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
        result = prime * result + ((getRecycleId() == null) ? 0 : getRecycleId().hashCode());
        result = prime * result + ((getData() == null) ? 0 : getData().hashCode());
        result = prime * result + ((getDataTable() == null) ? 0 : getDataTable().hashCode());
        result = prime * result + ((getPrimaryKey() == null) ? 0 : getPrimaryKey().hashCode());
        result = prime * result + ((getIsRestore() == null) ? 0 : getIsRestore().hashCode());
        result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
        result = prime * result + ((getUseragent() == null) ? 0 : getUseragent().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", adminId=").append(adminId);
        sb.append(", recycleId=").append(recycleId);
        sb.append(", data=").append(data);
        sb.append(", dataTable=").append(dataTable);
        sb.append(", primaryKey=").append(primaryKey);
        sb.append(", isRestore=").append(isRestore);
        sb.append(", ip=").append(ip);
        sb.append(", useragent=").append(useragent);
        sb.append(", createtime=").append(createtime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}